﻿using System;
using System.Windows.Media;
using Telerik.Windows.Controls;

namespace Portfel.ViewModels
{
    public class DataItemViewModel : ViewModelBase
    {
        private Uri _imageThumbnailSource;
        private string _information;
        private string _termin;
        private string _title;
        private Brush color;
        private string group;
        private string kurs;
        private string max;
        private string min;
        private string obroty;
        private string wolumen;
        private string zmiana;
        private string zmianaProcent;


        public Brush Color
        {
            get { return color; }
            set
            {
                if (color != value)
                {
                    color = value;
                    OnPropertyChanged("Color");
                }
            }
        }

        public string Wolumen
        {
            get { return wolumen; }
            set
            {
                if (wolumen != value)
                {
                    wolumen = value;
                    OnPropertyChanged("Wolumen");
                }
            }
        }

        public string Obroty
        {
            get { return obroty; }
            set
            {
                if (obroty != value)
                {
                    obroty = value;
                    OnPropertyChanged("Obroty");
                }
            }
        }

        public string Min
        {
            get { return min; }
            set
            {
                if (min != value)
                {
                    min = value;
                    OnPropertyChanged("Min");
                }
            }
        }

        public string Max
        {
            get { return max; }
            set
            {
                if (max != value)
                {
                    max = value;
                    OnPropertyChanged("Max");
                }
            }
        }

        /// <summary>
        ///     Gets or sets the image thumbnail source.
        /// </summary>
        public Uri ImageThumbnailSource
        {
            get { return _imageThumbnailSource; }
            set
            {
                if (_imageThumbnailSource != value)
                {
                    _imageThumbnailSource = value;
                    OnPropertyChanged("ImageThumbnailSource");
                }
            }
        }

        /// <summary>
        ///     Gets or sets the title.
        /// </summary>
        public string Title
        {
            get { return _title; }
            set
            {
                if (_title != value)
                {
                    _title = value;
                    OnPropertyChanged("Title");
                }
            }
        }

        /// <summary>
        ///     Gets or sets the information.
        /// </summary>
        public string Information
        {
            get { return _information; }
            set
            {
                if (_information != value)
                {
                    _information = value;
                    OnPropertyChanged("Information");
                }
            }
        }


        public string Kurs
        {
            get { return kurs; }
            set
            {
                if (kurs != value)
                {
                    kurs = value;
                    OnPropertyChanged("Kurs");
                }
            }
        }

        public string ZmianaProcent
        {
            get { return zmianaProcent; }
            set
            {
                if (zmianaProcent != value)
                {
                    zmianaProcent = value;
                    OnPropertyChanged("ZmianaProcent");
                }
            }
        }

        public string Zmiana
        {
            get { return zmiana; }
            set
            {
                if (zmiana != value)
                {
                    zmiana = value;
                    OnPropertyChanged("Zmiana");
                }
            }
        }

        /// <summary>
        ///     Gets or sets the group.
        /// </summary>
        public string Group
        {
            get { return @group; }
            set
            {
                if (@group != value)
                {
                    @group = value;
                    OnPropertyChanged("Group");
                }
            }
        }


        public string Termin
        {
            get { return _termin; }
            set
            {
                if (_termin != value)
                {
                    _termin = value;
                    OnPropertyChanged("Termin");
                }
            }
        }

        /// <summary>
        ///     Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>
        ///     A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return _title;
        }

        /// <summary>
        ///     Determines whether the specified <see cref="System.Object" /> is equal to this instance.
        /// </summary>
        /// <param name="obj">
        ///     The <see cref="System.Object" /> to compare with this instance.
        /// </param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            var typedObject = obj as DataItemViewModel;
            if (typedObject == null)
            {
                return false;
            }
            return Title == typedObject.Title && Information == typedObject.Information;
        }

        /// <summary>
        ///     Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        ///     A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
        /// </returns>
        public override int GetHashCode()
        {
            return Title.GetHashCode() ^ Information.GetHashCode();
        }
    }
}